import java.io.*;
import java.text.*;
import java.math.*;
import java.util.*;

public class Football implements Runnable {

	final static String taskname = "filename";

	public enum Teams {
		AERLAND(0), BERLAND(1), CERLAND(2), DERLAND(3);

		private final int id;

		Teams(int id) {
			this.id = id;
		}

		public int getValue() {
			return id;
		}
	}

	public void solve() throws Exception {
    //	int n = iread();	
    
    int[]  goalScore = new int[4];
    int[]  pointScore = new int[4];
    
    int[]   k1 = new int[4];
    
     for ( int i=0; i<5; i++){
    	 
    	 String[] input = in.readLine().split(" +");
    	 
    	  int[]  curScore = new int[2];
    	  
    	  curScore[0] =Integer.parseInt( input[2].split(":")[0]);
    	  curScore[1] =Integer.parseInt( input[2].split(":")[1]);
    	  
    	  
    	  
    	  goalScore[Teams.valueOf(input[0]).getValue()] += curScore[0];
    	  goalScore[Teams.valueOf(input[1]).getValue()] += curScore[1];
    	  
    	  if ( curScore[0]>curScore[1]) {
    		  
    		  pointScore[Teams.valueOf(input[0]).getValue()] += 3;
    		      	  }
          if ( curScore[1]>curScore[0]) {
    		  
    		  pointScore[Teams.valueOf(input[1]).getValue()] += 3;
    	  }
          if ( curScore[1] == curScore[0]) {
    		  
    		  pointScore[Teams.valueOf(input[0]).getValue()] += 1;
    		  pointScore[Teams.valueOf(input[1]).getValue()] += 1;
    	  }
          k1[Teams.valueOf(input[0]).getValue()] += curScore[0]-curScore[1];
		  k1[Teams.valueOf(input[1]).getValue()] += curScore[1]-curScore[0];
     }
    
    	
    //	out.write(ans + "\n");
    //    out.write(ans_path + "\n");
    }

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new BufferedWriter(new OutputStreamWriter(System.out));
			// in = new BufferedReader(new FileReader(taskname + ".in"));
			// out = new BufferedWriter(new FileWriter(taskname + ".out"));
			solve();
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public int iread() throws Exception {
		return Integer.parseInt(readword());
	}

	public double dread() throws Exception {
		return Double.parseDouble(readword());
	}

	public long lread() throws Exception {
		return Long.parseLong(readword());
	}

	BufferedReader in;

	BufferedWriter out;

	public String readword() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) {
		// Locale.setDefault(Locale.US);
		new Thread(new Football()).start();
	}
}